package com.zhijian.medical.entity.vo.request;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.List;

/**
 * 考核-录入题目vo
 *
 * @author HCG
 * @version 1.0
 * @date 2022/1/4
 */
@Data
@Api(tags = "考核-录入题目vo")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ExamQuestionInsertVo implements Serializable {

    private static final long serialVersionUID = -1;

    /**
     * 题目内容
     */
    @ApiModelProperty("题目内容")
    @NotBlank(message = "题目内容不能为空")
    private String content;

    /**
     * 题目类型，0：单选题，1：多选题，2：填空题，3：简答题
     */
    @ApiModelProperty("题目类型，0：单选题，1：多选题，2：填空题，3：简答题")
    @NotNull(message = "题目类型不能为空")
    @Max(value = 3, message = "题目类型只能为0,1,2,3")
    @Min(value = 0, message = "题目类型只能为0,1,2,3")
    private Byte type;

    /**
     * 答案
     */
    @ApiModelProperty("答案")
    @Size(min = 1, message = "答案至少有一条")
    @Valid
    private List<ExamAnswerInsertVo> answers;

    @Data
    @Api(tags = "考核-录入答案vo")
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class ExamAnswerInsertVo implements Serializable {

        private static final long serialVersionUID = -1;

        /**
         * 答案内容
         */
        @ApiModelProperty("答案内容")
        @NotBlank(message = "答案内容不能为空")
        private String content;

        /**
         * 是否是正确答案，0：是，1：否
         */
        @ApiModelProperty("是否是正确答案，0：是，1：否")
        @NotNull(message = "是否是正确答案不能为空")
        @Max(value = 1, message = "是否是正确答案只能为0,1")
        @Min(value = 0, message = "是否是正确答案只能为0,1")
        private Byte weatherRight;

    }
}
